#ifndef __CONF_SAVE_AND_LOAD
#define __CONF_SAVE_AND_LOAD

#include "main.h"
#include "stdbool.h"
#include "motor.h"

typedef struct __attribute__((packed, aligned(4)))
{
  uint8_t header;       // 帧头
  uint8_t reserved[3];  // 保留字段，用于对齐
  uint32_t payloadlen;  // 负载长度
} SaveHeader;

bool conf_saveAndLoad_test(void);

bool conf_save(motor_config_t* conf);

bool conf_load(motor_config_t* conf);

size_t assemble_frame(
  SaveHeader *saveheader, 
  uint8_t *payload, 
  size_t payload_len,
  uint8_t *frame,
  size_t max_frame_len
);

#endif // !__CONF_SAVE_AND_LOAD
